<link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/css/bootstrap-fileupload.css" />
<?php
/** @var ProductoController $this */
/** @var Producto $model */
/** @var AweActiveForm $form */
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'type' => 'horizontal',
    'id' => 'producto-form',
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
    'enableAjaxValidation' => false,
    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
    'enableClientValidation' => true,
        ));
?>

<div class="widget green ">
    <div class="widget-title ">
        <h4>
            <i class="icon-truck"></i><?php echo Yii::t('AweCrud.app', 'Create') . ' ' . Producto::label(); ?>        </h4>
        <span class="tools">
            <a class="icon-chevron-down"></a>
        </span>
    </div>
    <div class="widget-body">
        <p class="note">
            <?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span>
            <?php echo Yii::t('AweCrud.app', 'are required') ?>.        
        </p>


        <?php echo $form->textFieldRow($model, 'nombre', array('maxlength' => 45)) ?>

        <?php // echo $form->textAreaRow($model, 'foto', array('rows' => 3, 'cols' => 50)) ?>
        
        <?php echo $form->textFieldRow($model, 'cantidad', array('maxlength' => 10)) ?>
        
        <?php echo $form->textFieldRow($model, 'precio_unitario', array('maxlength' => 10)) ?>
        
        <?php echo $form->textFieldRow($model, 'percha', array('maxlength' => 45)) ?>
        
        <?php echo $form->textFieldRow($model, 'stock_minimo', array('maxlength' => 10)) ?>
        
        <?php echo $form->dropDownListRow($model, 'estado', array('ACTIVO' => 'Activo', 'INACTIVO' => 'Inactivo',)) ?>
        
        <?php echo $form->textFieldRow($model, 'descripcion', array('maxlength' => 45)) ?>

        <?php echo $form->dropDownListRow($model, 'proveedor_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Proveedor::model()->findAll(), 'id', Proveedor::representingColumn())) ?>

        <?php echo $form->dropDownListRow($model, 'categoria_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Categoria::model()->findAll(), 'id', Categoria::representingColumn())) ?>

        <?php echo $form->dropDownListRow($model, 'bodega_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Bodega::model()->findAll(), 'id', Bodega::representingColumn())) ?>
        <div class="control-group">
            <label class="control-label">Image Upload</label>
            <div class="controls">
                <div data-provides="fileupload" class="fileupload fileupload-new">
                    <div style="width: 200px; height: 150px;" class="fileupload-new thumbnail">
                        <img alt="" src="<?php echo $model->foto != NULL ? Yii::app()->baseUrl . '/images/productos/' . $model->foto : " http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=no+image" ?>">
                    </div>
                    <div style="max-width: 200px; max-height: 150px; line-height: 20px;" class="fileupload-preview fileupload-exists thumbnail"></div>
                    <div>
                        <span class="btn btn-file"><span class="fileupload-new">Seleccione imagen</span>
                            <span class="fileupload-exists">Cambiar</span>
                            <input name="Producto[foto]"  type="file" class="default"></span>
                        <a data-dismiss="fileupload" class="btn fileupload-exists" href="#">Remover</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-actions">
            <div class="form-actions-float">
                <?php
                $this->widget('bootstrap.widgets.TbButton', array(
                    'buttonType' => 'submit',
                    'type' => 'primary',
                    'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                ));
                ?>
                <?php
                $this->widget('bootstrap.widgets.TbButton', array(
                    //'buttonType'=>'submit',
                    'label' => Yii::t('AweCrud.app', 'Cancel'),
                    'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
                ));
                ?>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/bootstrap-fileupload.js"></script>
<?php $this->endWidget(); ?>
